package com.codes.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.Date;

public class ProjectDemo {

    /**
     * @ApiModelProperty()用于方法，字段； 表示对model属性的说明或者数据操作更改
     * value–字段说明
     * name–重写属性名字  默认为字段名,无需重写
     * dataType–重写属性类型
     * required–是否必填 false
     * example–举例说明  接口调用时候 会默认赋值
     * hidden–隐藏  确保任何接口都不用此属性, 否则在方法上使用增强注解
     *                                     @ApiOperationSupport(ignoreParameters = {"id","orderDate.id"})
     */

    @ApiModelProperty(value="项目ID",name="id",example="1") // int 类型 不写example  会报类型转换异常 ...... 我吐了
    private Integer id;
    @ApiModelProperty(value="项目名称",example="宝龙项目",required=true)
    private String name;

    /**
     *   消息验证
     */
    @ApiModelProperty("项目所在地址")
    @Size(min = 1,max = 20,message = "项目地址的长度必须为1到20")
    @NotBlank(message =  "地址不能为空")
    private String address;


    @ApiModelProperty("项目所在楼栋号")
    @Size(min = 1,max = 10,message = "楼栋号的长度必须为1到10")
    private String building;
    @ApiModelProperty(value="项目负责人ID",example="1")
    private Integer projectLeader;
    @ApiModelProperty(value="是否删除",example="0")
    private Integer isDelete;

    // test
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value="创建时间格式：yyyy-MM-dd HH:mm:ss",example="2020-05-23 09:30:00")
    private Date startTime;


    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty("创建时间，格式：yyyy-MM-dd HH:mm:ss")
    private String endTime;

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public String getEndTime() {
        return endTime;
    }

    public void setEndTime(String endTime) {
        this.endTime = endTime;
    }

    public Integer getIsDelete() {
        return isDelete;
    }

    public void setIsDelete(Integer isDelete) {
        this.isDelete = isDelete;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address == null ? null : address.trim();
    }

    public String getBuilding() {
        return building;
    }

    public void setBuilding(String building) {
        this.building = building == null ? null : building.trim();
    }

    public Integer getProjectLeader() {
        return projectLeader;
    }

    public void setProjectLeader(Integer projectLeader) {
        this.projectLeader = projectLeader;
    }
}